package com.example.lp.lpuicore.paint.model;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.RadialGradient;
import android.graphics.Shader;

/**
 * Author by lp,on 2021/6/17/017,14:29.
 */
public class CircleRendering implements IPaintModel {
    @Override
    public void draw(Canvas canvas, Paint paint) {
        /**
         * 环形渲染，RadialGradient(float centerX, float centerY, float radius, @ColorInt int colors[], @Nullable float stops[], TileMode tileMode)
         * centerX ,centerY：shader的中心坐标，开始渐变的坐标
         * radius:渐变的半径
         * centerColor,edgeColor:中心点渐变颜色，边界的渐变颜色
         * colors:渐变颜色数组
         * stoops:渐变位置数组，类似扫描渐变的positions数组，取值[0,1],中心点为0，半径到达位置为1.0f
         * tileMode:shader未覆盖以外的填充模式。
         */
        RadialGradient    mShader = new RadialGradient(500, 500, 250, new int[]{Color.GREEN, Color.YELLOW, Color.RED}, null, Shader.TileMode.MIRROR);
        paint.setShader(mShader);
        canvas.drawCircle(100, 100, 100, paint);
    }
}
